﻿#region Librerias

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Configuration;

#endregion


namespace ESF.General.Network.ConfigSettings
{
	[ConfigurationCollection (typeof (ConnectionTestElement))]  
	public class ConnectionTestElementParameterCollection : ConfigurationElementCollection
	{
		#region Propiedades
		
		public ConnectionTestElementParameter this[int index]
		{
			get 
			{
				return (ConnectionTestElementParameter) BaseGet(index); 
			}
			set
			{
				if (BaseGet(index) != null)
					BaseRemoveAt(index);
					
				BaseAdd(index, value);
			}
		}
		
		
		new public ConnectionTestElementParameter this[string Name]
		{
			get
			{
				return (ConnectionTestElementParameter) BaseGet(Name);
			}
		}
		
		#endregion
		
		
		#region Funciones
		
		public int IndexOf(ConnectionTestElementParameter item)
		{
			return BaseIndexOf(item);
		}

		
		public void Add(ConnectionTestElementParameter item)
		{
			BaseAdd(item);
		}
		
		
		protected override void BaseAdd(ConfigurationElement element)
		{
			BaseAdd(element, false);
		}
		

		public void Remove(ConnectionTestElementParameter pCnnTestElem)
		{
			if (BaseIndexOf(pCnnTestElem) >= 0)
				BaseRemove(pCnnTestElem.name);
		}
		
		
		protected override ConfigurationElement CreateNewElement()
		{
			return new ConnectionTestElementParameter ();
		}
		
		
		protected override object GetElementKey (ConfigurationElement pElement)
		{
			return ((ConnectionTestElementParameter) pElement).name;
		}
		
		#endregion
	}
}
